package com.study.kt._04project.game_tank.model

import com.study.kt._04project.game_tank.Config
import com.study.kt._04project.game_tank.business.Attachable
import com.study.kt._04project.game_tank.business.Blockable
import com.study.kt._04project.game_tank.business.Sufferable
import org.itheima.kotlin.game.core.Painter

/**
 * 我方大本营
 *
 * 大本营有阻挡的能力
 * 挨打的能力
 */
class Camp(override val x: Int, override val y: Int) : Blockable, Sufferable {
    override var blood: Int = 12


    override val width: Int = Config.block * 2
    override val height: Int = Config.block + 32 //大本营图片+砖块的高度

    override fun draw() {
        //绘制上方4个砖块
        Painter.drawImage("img/steel_small.gif", x, y)
        Painter.drawImage("img/steel_small.gif", x + 32, y)
        Painter.drawImage("img/steel_small.gif", x + 64, y)
        Painter.drawImage("img/steel_small.gif", x + 96, y)
        //绘制左侧剩余砖块
        Painter.drawImage("img/steel_small.gif", x, y + 32)
        Painter.drawImage("img/steel_small.gif", x, y + 63)
        //绘制右侧剩余砖块
        Painter.drawImage("img/steel_small.gif", x + 96, y + 32)
        Painter.drawImage("img/steel_small.gif", x + 96, y + 64)
        //绘制大本营
        Painter.drawImage("img/symbol.gif", x + 32, y + 32)
    }

    override fun notifySuffer(attachable: Attachable): Array<View>? {
        blood -= attachable.attachPower
        return null
    }
}